import 'package:doctor_order_lib/doctor_order_lib.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(TipWrap(MyApp()));
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '医生端订单系统',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: '医生端订单系统'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    DoctorOrderLib.init();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      DoctorOrderLib.initWithContext(context);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          children: [
            RaisedButton(
              onPressed: () {
                DoctorOrderLib.jump2LoginPage(context);
              },
              child: Text('登录'),
            ),
            RaisedButton(
              onPressed: () {
                DoctorOrderLib.jump2PrescriptionOrderPage(context);
              },
              child: Text('处方订单'),
            )
          ],
        ),
      ),
    );
  }
}
